package nix.web.interceptor;

import java.util.Map;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;

public class PrivilegeInterceptor extends MethodFilterInterceptor {

	@Override
	protected String doIntercept(ActionInvocation invocation) throws Exception {
		// 登陆拦截器：判断登陆状态
		Map<String, Object> session = ActionContext.getContext().getSession();
		Object object = session.get("session_user");
		if (object == null) {
			return "toLogin";
		} else {
			return invocation.invoke();
		}
	}

}
